package com.hopes.bizz.poll.alarm.bo;

import com.hopes.bizz.poll.common.constant.enums.PollModDictEnum;
import com.hopes.bizz.poll.common.loigc.AlarmLogic;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import lombok.Data;

import java.util.List;

/**
 * @author daijie
 * @version 1.0
 * @date 2023/5/30 15:37
 * @Description: 报警数据统计
 */
@Data
public class AlarmStatistics {
    /**
     * 监控点
     */
    private Long monitorSiteId;
    /**
     * 报警次数
     */
    private Integer num;
    /**
     * 报警时长
     */
    private Long time;
    /**
     * 报警因子
     */
    private List<AlarmFactorStatistics> factors;
    /**
     * orgId
     */
    private Long orgId;

    public String getOrgIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, this.orgId);
    }

    public String getMonitorSiteStr() {
        return DictResolver.getItemLabelByValue(PollModDictEnum.monitor_site, this.monitorSiteId);
    }

    public String getTimeDesc() {
        return AlarmLogic.buildDurationTimeDesc( this.time * 60);
    }

    public String getNumStr() {
        return num + "次";
    }

    public String getTownId() {
        return DictResolver.getItemLabelByValue(PollModDictEnum.monitor_site_town, this.monitorSiteId);
    }

    public String getTownIdStr() {
        return DictResolver.getItemLabelByValue(PollModDictEnum.town_info, this.getTownId());
    }
}
